import Vue from 'vue'
import App from './App.vue'
import router from './router'
import './plugins/element.js'
import './assets/fonts/iconfont.css'
import './assets/fonts-icomoon/style.css'
import ZkTable from 'vue-table-with-tree-grid'
// 导入富文本编辑器
import VueQuillEditor from 'vue-quill-editor'
import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css'
import 'quill/dist/quill.bubble.css'
//导入全局样式表
import './assets/css/global.css'

import axios from 'axios'
axios.defaults.baseURL = 'http://127.0.0.1:8888/api/private/v1/'
//挂载到vue的原型对象上,这样每一个vue的组件都可以访问axios,发起ajax请求
Vue.prototype.$http = axios;

Vue.config.productionTip = false;

Vue.component(ZkTable.name, ZkTable);
//axios请求拦截
Vue.use(VueQuillEditor)
axios.interceptors.request.use(config => {
  //为请求对象,添加Token验证的Authorization
  const token = sessionStorage.getItem('token');
  config.headers.Authorization = token;
  sessionStorage.removeItem('tokenStatus');
  return config;
})
new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
